<!-- 抽屉组件 -->
<template>
    <div class="drawer">
        <div class="header" @click="setDown">
            <div class="left">{{drawerTitle}}</div>
            <div class="right" :class="isActive?'down':'up'"></div>
        </div>
        <div>
            <div>
                <img src="~assets/boardImg/u189.png" /><span>任务书</span>
            </div>
        </div>
        <div class="main" :style="isActive?'height:0':''">
            <slot></slot>
        </div>
    </div>
</template>

<script>
    export default {
        props: {
            // 渐变组件的标题
            drawerTitle: {
                type: String,
                default: ()=>{
                    return '我是一个标题'
                }
            },
        },
        data() {
            return {
                isActive: false,        // 是否点击展开
            }
        },
        methods: {
            // 展开或收缩
            setDown() {
                this.isActive = !this.isActive;
            }
        },
    }
</script>

<style lang="scss" scoped>
.drawer{
    padding: 10px 0;
    .header{
        overflow: hidden;
        background: linear-gradient(to right, rgba(96,152,232,1) 0%, rgba(255,255,255,0) 100%);
        padding: 8px 20px;
        box-shadow: 0px 2px 2px #fff;
        cursor: pointer;
        .left{
            float: left;
            font-size: 16px;
            color: #fff;
        }
        .right{
            float: right;
            width: 15px;
            height: 15px;
        }
        .down{
            background: url(~assets/boardImg/down.png) no-repeat;
            background-size: 100% auto;
        }
        .up{
            background: url(~assets/boardImg/up.png) no-repeat;
            background-size: 100% auto;
        }
    }
    .main{
        overflow: hidden;
    }
}
</style>